// sgu302
// 题解：
// 水题不解释。
//
// ml:run = $bin < input
#include <iostream>
#include <string>
#include <cctype>
#include <stack>

int main()
{
    std::ios_base::sync_with_stdio(false);
    std::stack<bool> up;
    for (char ch; std::cin >> ch; ) {
        if (ch != '<') {
            if (!up.empty()) ch = (up.top() ? std::toupper(ch) : std::tolower(ch));
            std::cout << ch;
        } else {
            std::cin >> ch;
            if (ch == '/') {
                for (; std::cin >> ch; ) if (ch == '>') break;
                up.pop();
            } else {
                if (ch == 'U') up.push(true);
                else up.push(false);
                for (; std::cin >> ch; ) if (ch == '>') break;
            }
        }
    }
    std::cout << "\n";
}

